[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
peek() Examine Word At Memory Location (Macro)
#include <dos.h>
int peek(segment,offset);
unsigned segment; Segment
unsigned offset; Offset
peek() examines a word at the memory address specified by
'segment':'offset'. peek() is treated as a macro if the header file
<dos.h> is included. If the file is not included, or if #undef is
used on it, peek() is a function.
Returns: A word--the value stored at the location specified by
'segment:offset'.
Portability: Unique to 8086 family of processors.
-------------------------------- Example ---------------------------------
The following statements use peek() to look at the contents of the
third element in an array.
#include <dos.h>
#include <stdio.h>
int a[8] = {10,20,30,40,50,60,70,80};
main()
{
int x;
x = peek(FP_SEG((int far *) a), FP_OFF(a) + 2*sizeof(int));
printf("x=%d\n", x);
}
See Also:
peekb()
poke()
pokeb()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson